<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        
        let input=`9,3,5`
        let list=input.split(',').map(v=>parseInt(v.trim()))
        console.log(list);
        let len=list.length
        let obj={
            1:[],
            2:[],
            3:[],
            4:[],
            5:[],
            6:[],
            7:[],
            8:[],
            9:[]
        }
        for(let i=0;i<len;i++){
            console.log(list[i]);
            
            obj[list[i]].push(i)
        }
        let res=[]
        for(let i=9;i>0;i--){
            while(obj[i].length){
                res.push(obj[i].shift())
            }
        }
        console.log(res);
        
        
    </script>
</body>
</html>